<template>
  <div>
    <div class="page-title">人员检查地点配置</div>
    <div class="page-content">
      <el-form
        label-width="120px"
        :model="submitData"
        ref="submitData"
        style="width: 100%"
      >
        <div>
          <el-form-item label="监督员：">
            <el-select
              @change="
                IDtoName();
                getTeam();
                getGroup();
                getLocation();
                getKey();
                getCheck();
                handleGetCheck();
                handleGetKey();
              "
              v-model="submitData.staffID"
              placeholder="请选择监督员"
              filterable
              clearable
            >
              <el-option
                v-for="item in names"
                :value="item.employeeID"
                :key="item.employeeID"
                :label="item.name"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-tag type="success">任务队</el-tag>
          <el-select
            @change="getNewTeam"
            v-model="formData.areaName1"
            placeholder="请选择添加任务地区"
            size="mini"
            clearable
          >
            <el-option
              v-for="item in formData.areas"
              :value="item.dictCode"
              :key="item.dictCode"
              :label="item.name"
            >
            </el-option>
          </el-select>
          <el-select
            v-model="formData.newTeam"
            multiple
            placeholder="请选择添加任务"
            size="mini"
            value-key="companyCode"
            clearable
          >
            <el-option
              v-for="item in newWork.Team"
              :value="item"
              :key="item.companyCode"
              :label="item.taskItem"
            >
            </el-option>
          </el-select>
          <el-button type="primary" size="mini" @click="addTeam()"
            >确认添加</el-button
          >
          <el-button type="primary" size="mini" @click="deleteSelectedTeam"
            >删除选中项</el-button
          >
          <el-table
            height="350"
            :data="postData.tableTeam"
            style="width: 100%"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55"> </el-table-column>

            <el-table-column label="地区" prop="areaName"> </el-table-column>
            <el-table-column label="姓名" prop="staffName"> </el-table-column>
            <el-table-column label="作业队" prop="taskItem"> </el-table-column>
            <el-table-column label="操作" align="center" header-align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="deleteTeam(scope.row)"
                  type="primary"
                  >删除</el-button
                >
              </template>
            </el-table-column>
            <el-table-column align="right"> </el-table-column>
          </el-table>

          <el-tag type="success">生产辅助班组</el-tag>
          <el-select
            @change="getNewGroup"
            v-model="formData.areaName2"
            placeholder="请选择添加任务地区"
            size="mini"
            clearable
          >
            <el-option
              v-for="item in formData.areas"
              :value="item.dictCode"
              :key="item.dictCode"
              :label="item.name"
            >
            </el-option>
          </el-select>
          <el-select
            v-model="formData.newGroup"
            multiple
            placeholder="请选择添加任务"
            size="mini"
            value-key="companyCode"
            clearable
          >
            <el-option
              v-for="item in newWork.Groups"
              :value="item"
              :key="item.companyCode"
              :label="item.taskItem"
            >
            </el-option>
          </el-select>
          <el-button type="primary" size="mini" @click="addGroup()"
            >确认添加</el-button
          >
          <el-button type="primary" size="mini" @click="deleteSelectedTeam02"
            >删除选中项</el-button
          >
          <el-table
            max-height="250"
            :data="postData.tableGroup"
            style="width: 100%"
            @selection-change="handleSelectionChange02"
          >
            <el-table-column type="selection" width="55"> </el-table-column>

            <el-table-column label="地区" prop="areaName"> </el-table-column>
            <el-table-column label="姓名" prop="staffName"> </el-table-column>
            <el-table-column label="辅助班组" prop="taskItem">
            </el-table-column>
            <el-table-column label="操作" align="center" header-align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="deleteGroup(scope.row)"
                  type="primary"
                  >删除</el-button
                >
              </template>
            </el-table-column>
            <el-table-column align="right"> </el-table-column>
          </el-table>

          <el-tag type="success">重点部位</el-tag>
          <el-select
            @change="getNewLocation"
            v-model="formData.areaName3"
            placeholder="请选择添加任务地区"
            size="mini"
            clearable
          >
            <el-option
              v-for="item in formData.areas"
              :value="item.dictCode"
              :key="item.dictCode"
              :label="item.name"
            >
            </el-option>
          </el-select>
          <el-select
            v-model="formData.newLocation"
            multiple
            placeholder="请选择添加任务"
            size="mini"
            value-key="companyCode"
            clearable
          >
            <el-option
              v-for="item in newWork.location"
              :value="item"
              :key="item.companyCode"
              :label="item.taskItem"
            >
            </el-option>
          </el-select>
          <el-button type="primary" size="mini" @click="addLocation()"
            >确认添加</el-button
          >
          <el-button type="primary" size="mini" @click="deleteSelectedTeam03"
            >删除选中项</el-button
          >
          <el-table
            max-height="250"
            :data="postData.tableLocation"
            style="width: 100%"
            @selection-change="handleSelectionChange03"
          >
            <el-table-column type="selection" width="55"> </el-table-column>

            <el-table-column label="地区" prop="areaName"> </el-table-column>
            <el-table-column label="姓名" prop="staffName"> </el-table-column>
            <el-table-column label="重点部位" prop="taskItem">
            </el-table-column>
            <el-table-column label="操作" align="center" header-align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="deleteLocation(scope.row)"
                  type="primary"
                  >删除</el-button
                >
              </template>
            </el-table-column>
            <el-table-column align="right">
              <template slot="header"> </template>
            </el-table-column>
          </el-table>
          <el-tag type="success">关键环节</el-tag>
          <el-select
            v-model="formData.newKey"
            multiple
            placeholder="请选择添加任务"
            size="mini"
            value-key="dictCode"
            clearable
          >
            <el-option
              v-for="item in newWork.key"
              :value="item"
              :key="item.dictCode"
              :label="item.name"
            >
            </el-option>
          </el-select>
          <el-button type="primary" size="mini" @click="addKey()"
            >确认添加</el-button
          >
          <el-button type="primary" size="mini" @click="deleteSelectedTeam04"
            >删除选中项</el-button
          >
          <el-table
            max-height="250"
            :data="postData.tableKey"
            style="width: 100%"
            @selection-change="handleSelectionChange04"
          >
            <el-table-column type="selection" width="55"> </el-table-column>

            <el-table-column label="关键环节" prop="taskItem">
            </el-table-column>
            <el-table-column label="姓名" prop="staffName"> </el-table-column>
            <el-table-column label="操作" align="center" header-align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="deleteKey(scope.row)"
                  type="primary"
                  >删除</el-button
                >
              </template>
            </el-table-column>
            <el-table-column align="right">
              <template slot="header"> </template>
            </el-table-column>
          </el-table>

          <el-tag type="success">专项检查</el-tag>
          <el-select
            v-model="formData.newCheck"
            multiple
            placeholder="请选择添加任务"
            size="mini"
            value-key="dictCode"
            clearable
          >
            <el-option
              v-for="item in newWork.check"
              :value="item"
              :key="item.dictCode"
              :label="item.name"
            >
            </el-option>
          </el-select>
          <el-button type="primary" size="mini" @click="addCheck()"
            >确认添加</el-button
          >
          <el-button type="primary" size="mini" @click="deleteSelectedTeam05"
            >删除选中项</el-button
          >
          <el-table
            max-height="250"
            :data="postData.tableCheck"
            style="width: 100%"
            @selection-change="handleSelectionChange05"
          >
            <el-table-column type="selection" width="55"> </el-table-column>

            <el-table-column label="检查专项" prop="taskItem">
            </el-table-column>
            <el-table-column label="姓名" prop="staffName"> </el-table-column>
            <el-table-column label="操作" align="center" header-align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  @click="deleteCheck(scope.row)"
                  type="primary"
                  >删除</el-button
                >
              </template>
            </el-table-column>
            <el-table-column align="right">
              <template slot="header"> </template>
            </el-table-column>
          </el-table>
          <br />
        </div>
        <div align="center" header-align="center">
          <el-button type="primary" @click="handleSubmit('submitData')"
            >保存</el-button
          >
          <el-button type="danger" @click="cancel()" style="margin-left: 20px"
            >取消</el-button
          >
        </div>
      </el-form>
    </div>
  </div>
</template>


<script>
import {
  getWork,
  getGroups,
  getNames,
  postWork2,
  updateTask,
  getUntreatedSupervisionArea,
  getUntreatedCheckType,
} from "../../../services/task_issue";
import { GetDictionary } from "../../../services/dictionary";
export default {
  mounted() {
    this.getPerson();
    this.getAreaName();
  },
  methods: {
    //表中选择框发生变化
    handleSelectionChange(val) {
      this.multipleSelection = val;
    //   console.log(111, this.multipleSelection);
    },
    handleSelectionChange02(val) {
      this.multipleSelection02 = val;
    //   console.log(111, this.multipleSelection);
    },
    handleSelectionChange03(val) {
      this.multipleSelection03 = val;
    //   console.log(111, this.multipleSelection);
    },
    handleSelectionChange04(val) {
      this.multipleSelection04 = val;
    //   console.log(111, this.multipleSelection);
    },
    handleSelectionChange05(val) {
      this.multipleSelection05 = val;
    //   console.log(111, this.multipleSelection);
    },




    //批量删除
    deleteSelectedTeam() {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
          for (let key in this.multipleSelection) {
            for (let item in this.postData.tableTeam) {
              if (this.multipleSelection[key].companyCode == this.postData.tableTeam[item].companyCode) {
                  this.$delete(this.postData.tableTeam, item);
                // console.log(333,this.multipleSelection[key].companyCode);
              }
            }
          }
        }).catch(() => {});
    },
    deleteSelectedTeam02() {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
          for (let key in this.multipleSelection02) {
            for (let item in this.postData.tableGroup) {
              if (this.multipleSelection02[key].companyCode == this.postData.tableGroup[item].companyCode) {
                  this.$delete(this.postData.tableGroup, item);
                // console.log(333,this.multipleSelection[key].companyCode);
              }
            }
          }
        }).catch(() => {});
    },
    deleteSelectedTeam03() {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
          for (let key in this.multipleSelection03) {
            for (let item in this.postData.tableLocation) {
              if (this.multipleSelection03[key].companyCode == this.postData.tableLocation[item].companyCode) {
                  this.$delete(this.postData.tableLocation, item);
                // console.log(333,this.multipleSelection[key].companyCode);
              }
            }
          }
        }).catch(() => {});
    },
    deleteSelectedTeam04() {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
          for (let key in this.multipleSelection04) {
            for (let item in this.postData.tableKey) {
              if (this.multipleSelection04[key].companyCode == this.postData.tableKey[item].companyCode) {
                  this.$delete(this.postData.tableKey, item);
                // console.log(333,this.multipleSelection[key].companyCode);
              }
            }
          }
        }).catch(() => {});
    },
    deleteSelectedTeam05() {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
          for (let key in this.multipleSelection05) {
            for (let item in this.postData.tableCheck) {
              if (this.multipleSelection05[key].companyCode == this.postData.tableCheck[item].companyCode) {
                  this.$delete(this.postData.tableCheck, item);
                // console.log(333,this.multipleSelection[key].companyCode);
              }
            }
          }
        }).catch(() => {});
    },










    IDtoName() {
      for (let key in this.names) {
        if (this.names[key].employeeID == this.submitData.staffID) {
          this.toID.staffName[0] = this.names[key].name;
        }
      }
    },
    handleGetKey() {
      this.getNewWork4.staffID = this.submitData.staffID;
      getUntreatedCheckType(this.getNewWork4)
        .then((res) => {
          this.newWork.key = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    handleGetCheck() {
      this.getNewWork5.staffID = this.submitData.staffID;
      getUntreatedCheckType(this.getNewWork5)
        .then((res) => {
          this.newWork.check = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getAreaName() {
      getGroups()
        .then((res) => {
          this.formData.areas = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getPerson() {
      getNames()
        .then((res) => {
          this.names = res.data;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getNewGroup() {
      this.getNewWork2.areaID = this.formData.areaName2;
      this.getNewWork2.companyType = "配属班组";
      this.getNewWork2.staffID = this.submitData.staffID;
      getUntreatedSupervisionArea(this.getNewWork2).then((res) => {
        this.newWork.Groups = res.data;
      });
    },
    getNewLocation() {
      this.getNewWork3.areaID = this.formData.areaName3;
      this.getNewWork3.companyType = "重点要害部位及固定场所";
      this.getNewWork3.staffID = this.submitData.staffID;
      getUntreatedSupervisionArea(this.getNewWork3).then((res) => {
        this.newWork.location = res.data;
      });
    },
    getNewTeam() {
      this.getNewWork1.staffID = this.submitData.staffID;
      this.getNewWork1.areaID = this.formData.areaName1;
      this.getNewWork1.companyType = "作业队";
      getUntreatedSupervisionArea(this.getNewWork1).then((res) => {
        this.newWork.Team = res.data;
      });
    },

    addTeam() {
      var flag = true;
      if (JSON.stringify(this.formData.newTeam) != "{}") {
        for (var key in this.postData.tableTeam) {
          if (
            this.formData.newTeam.companyCode ==
            this.postData.tableTeam[key].companyCode
          ) {
            this.$confirm("不能重复添加！", "提示", {
              confirmButtonText: "确定",
              type: "warning",
            });
            flag = false;
          }
        }
        if (flag) {
          this.formData.newTeam.map((item) => {
            item.staffName = this.toID.staffName[0];
          });
          for (
            var teamNum = 0;
            teamNum < this.formData.newTeam.length;
            teamNum++
          ) {
            this.postData.tableTeam.push(this.formData.newTeam[teamNum]);
          }
          // this.formData.newTeam.staffName=this.toID.staffName[0]
          // this.postData.tableTeam.push(this.formData.newTeam)
          this.formData.newTeam = [];
        }
      } else {
        this.$confirm("不能添加为空！", "提示", {
          confirmButtonText: "确定",
          type: "warning",
        });
      }
    },
    addGroup() {
      var flag = true;
      if (JSON.stringify(this.formData.newGroup) != "{}") {
        for (var key in this.postData.tableGroup) {
          if (
            this.formData.newGroup.companyCode ==
            this.postData.tableGroup[key].companyCode
          ) {
            this.$confirm("不能重复添加！", "提示", {
              confirmButtonText: "确定",
              type: "warning",
            });
            flag = false;
          }
        }
        if (flag) {
          this.formData.newGroup.map((item) => {
            item.staffName = this.toID.staffName[0];
          });
          for (
            var groupNum = 0;
            groupNum < this.formData.newGroup.length;
            groupNum++
          ) {
            this.postData.tableGroup.push(this.formData.newGroup[groupNum]);
          }
          // this.formData.newGroup.staffName=this.toID.staffName[0]
          // this.postData.tableGroup.push(this.formData.newGroup)
          this.formData.newGroup = [];
        }
      } else {
        this.$confirm("不能添加为空！", "提示", {
          confirmButtonText: "确定",
          type: "warning",
        });
      }
    },
    addLocation() {
      var flag = true;
      if (JSON.stringify(this.formData.newLocation) != "{}") {
        for (var key in this.postData.tableLocation) {
          if (
            this.formData.newLocation.companyCode ==
            this.postData.tableLocation[key].companyCode
          ) {
            this.$confirm("不能重复添加！", "提示", {
              confirmButtonText: "确定",
              type: "warning",
            });
            flag = false;
          }
        }
        if (flag) {
          this.formData.newLocation.map((item) => {
            item.staffName = this.toID.staffName[0];
          });
          for (
            var locationNum = 0;
            locationNum < this.formData.newLocation.length;
            locationNum++
          ) {
            this.postData.tableLocation.push(
              this.formData.newLocation[locationNum]
            );
          }
          // this.formData.newLocation.staffName=this.toID.staffName[0]
          // this.postData.tableLocation.push(this.formData.newLocation)
          this.formData.newLocation = [];
        }
      } else {
        this.$confirm("不能添加为空！", "提示", {
          confirmButtonText: "确定",
          type: "warning",
        });
      }
    },
    addKey() {
      var flag = true;
      if (JSON.stringify(this.formData.newKey) != "{}") {
        for (var key in this.postData.tableKey) {
          if (
            this.formData.newKey.dictCode ==
            this.postData.tableKey[key].companyCode
          ) {
            this.$confirm("不能重复添加！", "提示", {
              confirmButtonText: "确定",
              type: "warning",
            });
            flag = false;
          }
        }
        if (flag) {
          this.formData.newKey.map((item) => {
            item.staffName = this.toID.staffName[0];
            item.taskItem = item.name;
            item.companyCode = item.dictCode;
            item.taskType = "关键环节";
          });
          for (var keyNum = 0; keyNum < this.formData.newKey.length; keyNum++) {
            this.postData.tableKey.push(this.formData.newKey[keyNum]);
          }
          // this.formData.newKey.staffName=this.toID.staffName[0]
          // this.formData.newKey.taskItem=this.formData.newKey.name
          // this.formData.newKey.companyCode=this.formData.newKey.dictCode
          // this.formData.newKey.taskType='关键环节'
          // this.postData.tableKey.push(this.formData.newKey)
          this.formData.newKey = [];
        }
      } else {
        this.$confirm("不能添加为空！", "提示", {
          confirmButtonText: "确定",
          type: "warning",
        });
      }
    },
    addCheck() {
      var flag = true;
      if (JSON.stringify(this.formData.newCheck) != "{}") {
        for (var key in this.postData.tableCheck) {
          if (
            this.formData.newCheck.dictCode ==
            this.postData.tableCheck[key].companyCode
          ) {
            this.$confirm("不能重复添加！", "提示", {
              confirmButtonText: "确定",
              type: "warning",
            });
            flag = false;
          }
        }
        if (flag) {
          this.formData.newCheck.map((item) => {
            item.staffName = this.toID.staffName[0];
            item.taskItem = item.name;
            item.companyCode = item.dictCode;
            item.taskType = "专项检查";
          });
          for (
            var checkNum = 0;
            checkNum < this.formData.newCheck.length;
            checkNum++
          ) {
            this.postData.tableCheck.push(this.formData.newCheck[checkNum]);
          }
          //     this.formData.newCheck.staffName=this.toID.staffName[0]
          // this.formData.newCheck.taskItem=this.formData.newCheck.name
          // this.formData.newCheck.companyCode=this.formData.newCheck.dictCode
          // this.formData.newCheck.taskType='专项检查'
          // this.postData.tableCheck.push(this.formData.newCheck)
          this.formData.newCheck = [];
        }
      } else {
        this.$confirm("不能添加为空！", "提示", {
          confirmButtonText: "确定",
          type: "warning",
        });
      }
    },

    deleteTeam(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          for (let item in this.postData.tableTeam) {
            if (row.companyCode == this.postData.tableTeam[item].companyCode) {
              this.$delete(this.postData.tableTeam, item);
            }
          }
        })
        .catch(() => {});
    },
    deleteGroup(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          for (let item in this.postData.tableGroup) {
            if (row.companyCode == this.postData.tableGroup[item].companyCode) {
              this.$delete(this.postData.tableGroup, item);
            }
          }
        })
        .catch(() => {});
    },
    deleteLocation(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          for (let item in this.postData.tableLocation) {
            if (
              row.companyCode == this.postData.tableLocation[item].companyCode
            ) {
              this.$delete(this.postData.tableLocation, item);
            }
          }
        })
        .catch(() => {});
    },
    deleteKey(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          for (let item in this.postData.tableKey) {
            if (row.companyCode == this.postData.tableKey[item].companyCode) {
              this.$delete(this.postData.tableKey, item);
            }
          }
        })
        .catch(() => {});
    },
    deleteCheck(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          for (let item in this.postData.tableCheck) {
            if (row.companyCode == this.postData.tableCheck[item].companyCode) {
              this.$delete(this.postData.tableCheck, item);
            }
          }
        })
        .catch(() => {});
    },
    getTeam() {
      getWork(this.toID)
        .then((res) => {
          this.postData.tableTeam = res.team;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getGroup() {
      getWork(this.toID)
        .then((res) => {
          this.postData.tableGroup = res.group;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getLocation() {
      getWork(this.toID)
        .then((res) => {
          this.postData.tableLocation = res.location;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getKey() {
      getWork(this.toID)
        .then((res) => {
          this.postData.tableKey = res.key;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    getCheck() {
      getWork(this.toID)
        .then((res) => {
          this.postData.tableCheck = res.check;
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
    cancel() {
      this.postData.tableTeam = [];
      this.postData.tableGroup = [];
      this.postData.tableLocation = [];
      this.postData.tableKey = [];
      this.postData.tableCheck = [];
      this.toID.staffName = [];
      this.submitData.staffID = "";
      this.formData.areaName1 = "";
      this.formData.areaName2 = "";
      this.formData.areaName3 = "";
      this.formData.newCheck = {};
      this.formData.newKey = {};
      this.formData.newLocation = {};
      this.formData.newWork = {};
      this.formData.newGroup = {};
      this.newWork.Team = [];
      this.newWork.Groups = [];
      this.newWork.location = [];
      this.newWork.key = [];
      this.newWork.check = [];
      this.submitData.supervisionScope = [];
    },
    handleSubmit() {
      for (let item of this.postData.tableTeam) {
        var tmp = new Object();
        tmp.companyCode = item.companyCode;
        tmp.taskType = item.taskType;
        tmp.areaName = item.areaName;
        tmp.taskItem = item.taskItem;
        this.submitData.supervisionScope.push(tmp);
      }
      for (let item of this.postData.tableGroup) {
        var tmp = new Object();
        tmp.companyCode = item.companyCode;
        tmp.taskType = item.taskType;
        tmp.areaName = item.areaName;
        tmp.taskItem = item.taskItem;
        this.submitData.supervisionScope.push(tmp);
      }
      for (let item of this.postData.tableLocation) {
        var tmp = new Object();
        tmp.companyCode = item.companyCode;
        tmp.taskType = item.taskType;
        tmp.areaName = item.areaName;
        tmp.taskItem = item.taskItem;
        this.submitData.supervisionScope.push(tmp);
      }
      for (let item of this.postData.tableKey) {
        var tmp = new Object();
        tmp.companyCode = item.companyCode;
        tmp.taskType = item.taskType;
        tmp.areaName = item.areaName;
        tmp.taskItem = item.taskItem;
        this.submitData.supervisionScope.push(tmp);
      }
      for (let item of this.postData.tableCheck) {
        var tmp = new Object();
        tmp.companyCode = item.companyCode;
        tmp.taskType = item.taskType;
        tmp.areaName = item.areaName;
        tmp.taskItem = item.taskItem;
        this.submitData.supervisionScope.push(tmp);
      }
      updateTask(this.submitData)
        .then(() => {
          this.$message.success("保存成功");
          this.getTeam();
          this.getGroup();
          this.getLocation();
          this.getKey();
          this.getCheck();
          this.handleGetKey();
          this.handleGetCheck();
          this.submitData.supervisionScope = [];
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
    },
  },

  data() {
    return {
      //设置多选框属性
      isIndeterminate: true,
      checkAll: false,
      multipleSelection: [],
      multipleSelection02:[],
      multipleSelection03:[],
      multipleSelection04:[],
      multipleSelection05:[],

      getNewWork1: {
        areaID: "",
        companyType: "",
        staffID: "",
      },
      getNewWork2: {
        areaID: "",
        companyType: "",
        staffID: "",
      },
      getNewWork3: {
        areaID: "",
        companyType: "",
        staffID: "",
      },
      getNewWork4: {
        code: "0043",
        staffID: "",
      },
      getNewWork5: {
        code: "0042",
        staffID: "",
      },
      names: [],
      toID: {
        staffName: [],
      },
      submitData: {
        staffID: "",
        supervisionScope: [],
      },
      postData: {
        tableTeam: [],
        tableGroup: [],
        tableLocation: [],
        tableKey: [],
        tableCheck: [],
      },
      formData: {
        areaName1: "",
        areaName2: "",
        areaName3: "",
        areas: [],
        newTeam: [],
        newGroup: [],
        newLocation: [],
        newKey: [],
        newCheck: [],
      },
      newWork: {
        Team: [],
        Groups: [],
        location: [],
        key: [],
        check: [],
      },
    };
  },
};
</script>

<style>
.el-checkbox {
  margin-left: 25px;
}

.cutting {
  padding: 0 0px 0px;
  margin: 20px 0px;
  line-height: 1px;
  border-left: 750px solid rgb(221, 221, 221);
  border-right: 750px solid rgb(221, 221, 221);
  text-align: center;
  height: 2px;
  width: 100%;
}
</style>